function stateShow(stateId){
	$.ajax({
		url:"/chat/orderShow",
		type:"POST",
		data : {
			orderShowState:stateId
		},
		success:function(result){
			window.location.href = "/chat/toOrderShow";
		}
	});
	
}
function detail(order){
	$.ajax({
		url:"/chat/detail",
		type:"POST",
		data : {
			orderId:order
		},
		success:function(result){
			window.location.href = "/chat/toOrder";
		}
	});
}
function type1(orderID){
//	alert(orderID);
	var stateID=2;
	$.ajax({
		url:"/chat/updataOrderState",
		type:"POST",
		data : {
			orderId:orderID,
			stateId:stateID
		},
		success:function(result){
			alert(result.addOrederResult);
			location.reload();
		}
	});
}
function type2(orderID){
//	alert(orderID);
	
	var stateID=3;
//	var day2 = new Date();
//	day2.setTime(day2.getTime());
//	var s2 = day2.getFullYear()+"-" + (day2.getMonth()+1) + "-" + day2.getDate()
//	+" "+day2.getHours()+":"+da2.getMinutes()+":"+da2.getSeconds();
//	alert(s2);
	$.ajax({
		url:"/chat/updataOrderState2",
		type:"POST",
		data : {
			orderId:orderID,
			stateId:stateID
//			orderComplete:s2
		},
		success:function(result){
			alert(result.addOrederResult);
			location.reload();
		}
	});
}
function type3(orderID){
//	alert(orderID);
	var stateID=4;
	$.ajax({
		url:"/chat/updataOrderState3",
		type:"POST",
		data : {
			orderId:orderID,
			stateId:stateID
		},
		success:function(result){
			alert(result.addOrederResult);
			location.reload();
		}
	});
}
function type4(orderID){
	$('#butType').val('1');
	$('#oi').val(orderID);
}
function type5(orderID){
	$('#butType').val('2');
	$('#oi').val(orderID);
}

function okComment(){
	var $select = $("#select");
    var $myselect = $("#myselect");
    var pingfen=$myselect.find("option:selected").text()
	var comments=$('#comments').val();
	var orderid=$('#oi').val();
	$.ajax({
		url:"/chat/updataOrderState4",
		type:"POST",
		data : {
			comment:comments,
			orderId:orderid,
			grade:pingfen
		},
		success:function(result){
			alert("OK!");
			location.reload();
		}
	});
}
function cancel(orderID){
	var stateID=1;
	$.ajax({
		url:"/chat/cancel",
		type:"POST",
		data : {
			stateId:stateID,
			orderId:orderID
		},
		success:function(result){
			alert(result.addOrederResult);
			location.reload();
		}
	});
}
